object Timer {
  def oncePerSecond(seconds:Int,callback: () => Unit): Unit =
    {
      while (true) {
        callback()
        Thread.sleep(seconds*1000)
      }
    }

  def timeFlies(): Unit =
    { Console.println("Time flies when you're having fun(ctionally)..."); }

  def main(args: Array[String]): Unit =
    {
      oncePerSecond(5,timeFlies)
      oncePerSecond(5,() => Console.println("Time flies... oh, you get the idea."))
    }
  
}